<?php
/**
 * 生成授权公众号的JS SDK请求
 *
 * Author: Zeon
 * Date: 2017/11/24
 * Created by Panxsoft.
 */
namespace App\Http\Requests\OpenWechat\Authorizer;

use App\Services\OpenWechat\JSSDKConfig;
use Illuminate\Validation\Rule;

/**
 * Class JSSDKRequest
 *
 * @property string target_url - 调用js sdk的网址 当前网址，不包含#及其后面部
 * @property array|null configs - 配置权限的数组
 * @property string debug - 是否开启 debug 模式
 *
 * @package App\Http\Requests\OpenWechat\Authorizer
 */
class JSSDKRequest extends AuthorizerAppidRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'target_url' => 'required|string',
            'configs.*' => Rule::in(JSSDKConfig::get()),
            'debug' => 'nullable|string',
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'configs.*.in' => '请求参数不在合法值范围中'
//        ];
//    }

}
